package com.app.configuration.web.session;

import java.util.HashMap;

import javax.servlet.http.HttpSession;

/**
 * 用于session记录
 * @author Administrator
 *
 */
public class SessionContext {
    private static HashMap<String, HttpSession> sessionMaps = new HashMap<String, HttpSession>();
    
    public static synchronized void addSession(HttpSession session) {
        if (session != null) {
        	sessionMaps.put(session.getId(), session);
         }
     }
     public static synchronized void delSession(HttpSession session) {
         if (session != null) {
        	 sessionMaps.remove(session.getId());
         }
     }
     public static synchronized HttpSession getSession(String session_id) {
        if (session_id == null)
             return null;
         return sessionMaps.get(session_id);
     }
     
     public static synchronized HashMap<String, HttpSession> getSessions() {
          return sessionMaps;
     }
}